package swu.edu.cn.javaee.controller;


import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import swu.edu.cn.javaee.entity.Photo;
import swu.edu.cn.javaee.entity.PhotoInfo;
import swu.edu.cn.javaee.service.PhotoService;

import java.util.List;

@Controller
public class PhotoController {

    @Resource
    private PhotoService photoService;

    @RequestMapping("/savePhoto")
    @ResponseBody
    public String savePhoto(Photo photo){
        String result= photoService.savePhoto(photo);
        return result;
    }

    @RequestMapping("/updatePhoto")
    @ResponseBody
    public String updatePhoto(Photo photo){
        String result=photoService.updatePhoto(photo);
        return result;
    }

    @RequestMapping("/deletePhoto")
    @ResponseBody
    public String deletePhoto(String paId){
        String result=photoService.deletePhoto(paId);
        return result;
    }

    @RequestMapping("/queryPhoto")
    @ResponseBody
    public PhotoInfo queryPhoto(String paCid){
        PhotoInfo photoInfo= photoService.queryPhoto(paCid);
        return photoInfo;
    }
}
